Skip to content

Conversation

alexeybakhtin
Copy link

@alexeybakhtin alexeybakhtin commented Sep 23, 2025

I'd like to backport JDK-8348986 to control sensitive information in Exception messages.

Backport from openjdk/jdk21u-dev#2132 is not clean. The following changes were applied manually:

  • src/java.base/share/classes/sun/nio/ch/DatagramSocketAdaptor.java
    • copyright year
  • src/java.base/share/classes/sun/nio/ch/NioSocketImpl.java
    • Throwing IOException from the connect() method is updated manually because of a context difference
  • src/java.base/share/classes/module-info.java
    • exports sun.security.util updated manually
  • src/java.base/share/classes/java/net/Inet4AddressImpl.java
    • changes discarded. JDK17 does not have JDK-8244202 and related changes : lookupAllHostAddr(String hostname, LookupPolicy lookupPolicy)
  • src/java.base/share/classes/java/net/InetAddress.java
    • throwing UnknownHostException from NameServiceAddresses::get is updated manually because of context differences
    • import section
    • no CachecdLookup and ValidCachedLookup classes in JDK17. changes discarded
  • src/java.base/share/classes/java/net/Proxy.java
    • copyright year
  • src/java.base/share/classes/java/net/SocketPermission.java
    • copyright year
  • src/java.base/share/classes/java/net/SocksSocketImpl.java
    • copyright year
  • src/java.base/share/classes/java/net/URI.java
    • import section
  • src/java.base/share/classes/java/net/URL.java
    • copyright year
  • src/java.base/share/classes/java/net/URLStreamHandler.java
    • copyright year
  • src/java.base/share/classes/sun/net/www/protocol/jar/Handler.java
    • copyright year
  • src/java.base/windows/native/libnet/Inet4AddressImpl.c
    • copyright year
  • src/java.base/windows/native/libnet/Inet6AddressImpl.c
    • copyright year
  • src/java.base/share/native/libnet/net_util.h
    • copyright year
    • getEnhancedExceptionsAllowed() declaration added manually because of context difference
  • src/java.naming/share/classes/com/sun/jndi/toolkit/url/Uri.java
    • parseCompat method is updated manually because of context differences
  • src/java.base/windows/classes/sun/nio/ch/WindowsAsynchronousSocketChannelImpl.java
    • copyright year
  • src/java.base/windows/classes/sun/nio/fs/WindowsUserPrincipals.java
    • copyright year
    • lookup method is updated manually because of context differences
  • src/jdk.httpserver/share/classes/sun/net/httpserver/simpleserver/JWebServer.java
    • no such class in JDK17

Modified and related JTREG tests are passed


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • JDK-8348986 needs maintainer approval
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change requires CSR request JDK-8366459 to be approved

Issues

  • JDK-8348986: Improve coverage of enhanced exception messages (Enhancement - P3)
  • JDK-8366459: Improve coverage of enhanced exception messages (CSR)

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk17u-dev.git pull/3989/head:pull/3989
$ git checkout pull/3989

Update a local copy of the PR:
$ git checkout pull/3989
$ git pull https://git.openjdk.org/jdk17u-dev.git pull/3989/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 3989

View PR using the GUI difftool:
$ git pr show -t 3989

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk17u-dev/pull/3989.diff

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Sep 23, 2025

👋 Welcome back abakhtin! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk
Copy link

openjdk bot commented Sep 23, 2025

❗ This change is not yet ready to be integrated.
See the Progress checklist in the description for automated requirements.

@openjdk openjdk bot changed the title Backport b6f827ef054959662190e21ce63fc3d3c45b92f3 8348986: Improve coverage of enhanced exception messages Sep 23, 2025
@openjdk
Copy link

openjdk bot commented Sep 23, 2025

This backport pull request has now been updated with issue from the original commit.

@openjdk openjdk bot added backport Port of a pull request already in a different code base rfr Pull request is ready for review labels Sep 23, 2025
@mlbridge
Copy link

mlbridge bot commented Sep 23, 2025

Webrevs

@sercher
Copy link
Contributor

sercher commented Sep 29, 2025

Hi @alexeybakhtin
I noticed that sun/net/util/SocketExceptions.java changed to an empty file. Is it as expected?

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only the copyright header changed

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you. Fixed

@@ -1,104 +0,0 @@
/*
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SocketExceptions becomes an empty file

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you. Removed

Comment on lines 339 to 340
java.naming,
java.rmi,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

duplicate

Comment on lines 339 to 345
java.naming,
java.rmi,
java.net.http,
java.xml.crypto,
jdk.crypto.ec,
jdk.crypto.cryptoki,
jdk.httpserver,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change must be for jdk.internal.util

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you. Moved

// connect failed, close the channel
close();
throw SocketExceptions.of(ioe, sa);
throw Exceptions.ioException(ioe, sa);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A similar change is needed also in AbstractPlainSocketImpl.java

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. Thank you. Fixed.

@alexeybakhtin alexeybakhtin marked this pull request as draft September 29, 2025 23:05
@openjdk openjdk bot removed the rfr Pull request is ready for review label Sep 29, 2025
@alexeybakhtin alexeybakhtin marked this pull request as ready for review September 30, 2025 13:58
@openjdk openjdk bot added the rfr Pull request is ready for review label Sep 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport Port of a pull request already in a different code base rfr Pull request is ready for review
Development

Successfully merging this pull request may close these issues.

2 participants